package com.adv.ems.model.vo;

import com.adv.ems.db.entity.EnergyInfoDO;
import com.adv.ems.db.entity.ItemInfoDO;
import com.adv.ems.utils.EmsUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.List;

@Data
public class BaseItemVO {
    private List<Info> list;

    public BaseItemVO() {
        this.list = new ArrayList<Info>();
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class Info {
        private Long id;
        private String energyName;
        private Long energyId;
        private String name;
        private String code;

        public Info(ItemInfoDO itemInfo, EnergyInfoDO energyInfo, String acceptLanguage) {
            this.id = itemInfo.getId();
            this.energyId = energyInfo.getId();
            this.energyName  = EmsUtil.multilingual(energyInfo.getNameInfo(), acceptLanguage);
            this.name = EmsUtil.multilingual(itemInfo.getNameInfo(), acceptLanguage);
            this.code = itemInfo.getCode();
        }
    }
}
